<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>工作时间</title>
	    <%@include file="/common/commonCSS.jsp" %>
	    <%@include file="/common/commonJS.jsp" %>
		<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
	</head>
	<body >
		<div class="main-container" id="main-container">
			<form class="form-horizontal  bv-form" id="incidentForm">
				<div style="display: none">
					<input id="id" name="id"  value="${timetblInfo.id}"/>
				</div>
				<div class="row">
					<div class="form-group col-xs-12 ">
						<label class="col-xs-3 control-label no-padding-right"><i class="red"> * </i>名称:</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input id="name" name="name" type="text" class="form-control" value="${timetblInfo.name}" />
							</span>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-xs-12 ">
						<label class="col-xs-3 control-label no-padding-right">描述:</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input id="content" name="content"  type="text" class="form-control" value="${timetblInfo.content}"/>
							</span>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="form-group col-xs-12">
						<label class="col-xs-3 control-label no-padding-right"><i class="red"> * </i> 状态:</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<tag:select nameKey="time_status" name="status" clazz="form-control" otherAttr="datatype=\"*\" " isAddDefaltOption="true" defaltOptionValue="--请选择--" initSelectedKey="${timetblInfo.status}"/>

							</span>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-xs-12">
						<label class="col-xs-3 control-label no-padding-right">创建日期：</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input  type="text" class="form-control" value="<fmt:formatDate value="${timetblInfo.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" readonly/>
							</span>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-xs-12">
						<label class="col-xs-3 control-label no-padding-right">创建人：</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input  type="text" class="form-control" value="${timetblInfo.createUser}" readonly/>
							</span>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-xs-12">
						<label class="col-xs-3 control-label no-padding-right">修改日期：</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input  type="text" class="form-control" value="<fmt:formatDate value="${timetblInfo.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>" readonly/>
							</span>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="form-group col-xs-12">
						<label class="col-xs-3 control-label no-padding-right">修改人：</label>
						<div class="col-xs-9">
							<span class="col-xs-11 block input-icon input-icon-right">
								<input  type="text" class="form-control" value="${timetblInfo.updateUser}" readonly/>
							</span>
						</div>
					</div>
				</div>
				<ul class="layui-tab-title">
					<li class="layui-this" id="worktime">工作时间</li>
					<li id="workdate">节假日定义</li>
				</ul>
				<div class="layui-tab-content" id="tabContent" style="margin-left: 10px">

				</div>
				<div class="layui-tab-content" id="tabContent1" style="margin-left: 10px; display: none;">

				</div>
				<div class="row" style="margin-left: 40%;padding-bottom: 28px;margin-top: 25px;">
					<button class="layui-btn" type="button" id="submitBtn">保 存</button>
					<a class="layui-btn layui-btn-normal" href="${webRoot}/sys/timetblinfo/list">返 回</a>
				</div>
			</form>
		</div>
	</body>
	<script>
		//提交
		$("#submitBtn").click(function () {
            checkFormValid($("#incidentForm"),function () {
			var url ="${webRoot}/sys/timetblinfo/save";
			$.post(url,$("#incidentForm").serialize(),function (result) {
				if(result.code == '0'){
					if($("#id").val() == ''){
                        alert(result,function () {
                            location.href='${webRoot}/sys/timetblinfo/list';
                        },function () {
                            $("#submitBtn").reset();
                        });
					}else {
                        //更新成功，返回List页面
                        toast(result.msg);
                        location.href='${webRoot}/sys/timetblinfo/list';
					}
				}else {
					alertMsg(result.msg);
				}

			});
		})
		});

        $(function () {
            var id = '${timetblInfo.id}';
            var url = "${webRoot}/sys/timetblworkdate/list";
            var params = {
                'tblId':id
            }
            $.get(url,params,function (r) {
                $("#tabContent1").html(r);
            });

            var url1 = "${webRoot}/sys/timetblworktime/list";
            var params1 = {
                'tmpId':id

            }
            $.get(url1,params1,function (r) {
                $("#tabContent").html(r);
            });

        });
        /**
         * 流程信息
         */
        $("#workdate").on("click",function () {

			$("#tabContent").hide();
            $("#tabContent1").show();

        })
        /**
         * 流程信息
         */
        $("#worktime").on("click",function () {
            $("#tabContent1").hide();
            $("#tabContent").show();
        })
        function deleteById(id) {
            var url ="${webRoot}/sys/timetblworkdate/delete";
            confirm('确定要删除选中的记录？', function(){
                $.post(url,"id="+id,function (r) {
                    if(r.code=='0'){
                        toast(r.msg);
                        $("#"+id+"").remove();
                        //location.href='${webRoot}/sys/timetblworkdate/list';
                    }else {
                        alertMsg(r.msg);
                    }
                });
            });
        }
        /**
         * 选择审批人
         */
        function addInfo(timetblWorkdateId) {
//            alert(timetblWorkdateId==undefined)
            var url="${webRoot}/sys/timetblworkdate/info"+(timetblWorkdateId==undefined?"":"?id="+timetblWorkdateId)
            //弹框层
            layer.open({
                scrollbar: true,
                type: 2,
                title : ['添加' , true],
                area: ['90%', '90%'], //宽高
                content: [url],
                shadeClose : false,
            });
        }

        function deleteWorktimeById(id) {
            var url ="${webRoot}/sys/timetblworktime/delete";
            confirm('确定要删除选中的记录？', function(){
                $.post(url,"id="+id,function (r) {
                    if(r.code=='0'){
                        toast(r.msg);
                        $("#"+id+"").remove();
                        //location.href='${webRoot}/sys/timetblworktime/list';
                    }else {
                        alertMsg(r.msg);
                    }
                });
            });
        }

        function addTimetblworktime(timetblworktimeId) {
            var url="${webRoot}/sys/timetblworktime/info"+(timetblworktimeId==undefined?"":"?id="+timetblworktimeId)
            //弹框层
            layer.open({
                scrollbar: true,
                type: 2,
                title : ['添加' , true],
                area: ['90%', '90%'], //宽高
                content: [url],
                shadeClose : false,
            });
        }
	</script>
</html>